AssetWise CONNECT Edition Implementation Guide

To Configure JSON Forms for Date Fields

In order to configure date and time attributes in JSON forms, you must set the type attribute to one of two possible values:
  • To display both date and time, set the value to "datetime", or,
  • To display only the date attribute, set the value to "date".

To define the type attribute, navigate to apps\alim\SPA\app\plugins\eB\config\layouts\. Using a text editor, open attribute.forms.json and set the type attribute to the appropriate value, then save the file.

The following example depicts JSON form that displays dates that include the date and time:
        {
          "label": "$DISPLAY_LABEL",
          "intrinsic": true,
          "type": "datetime",
          "width": "200px",
          "binding": "DateDiscovered",
          "disabled": true,
          "top": 100,
          "left": 10,
          "controlId": "control_125",
          "customValidators": [
            {
              "attributes": [
                {
                  "name": "date-discovered-validators",
                  "value": ""
                }
              ],
              "messages": [
                {
                  "name": "dateDiscoveredFuture",
                  "severity": "error",
                  "message": "CANNOT_OCCUR_IN_THE_FUTURE"
                },
                {
                  "name": "dateDiscoveredTagEffective",
                  "severity": "error",
                  "message": "CANNOT_OCCUR_PRIOR_TO_THE_$DYNAMIC_OBJECT_EFFECTIVE_DATE",
                  "objectTypeConfiguration": {
                    "objectType": 212
                  }
                },
                {
                  "name": "dateDiscoveredTaskStart",
                  "severity": "error",
                  "message": "CANNOT_OCCUR_PRIOR_TO_THE_$DYNAMIC_OBJECT_ACTUAL_START_DATE",
                  "objectTypeConfiguration": {
                    "objectType": 340,
                    "sysType": "I"
                  }
                }
              ]
            },
            {
              "attributes": [
                {
                  "name": "dir-compare-two-dates-validation",
                  "value": ""
                },
                {
                  "name": "other-date-string",
                  "value": "parentCtrl.currentGenericObject().DateRequired"
                },
                {
                  "name": "is-earlier-date",
                  "value": "true"
                }
              ],
              "messages": [
                {
                  "name": "compareTwoDates",
                  "severity": "error",
                  "message": "CANNOT_OCCUR_AFTER_THE_DATE_REQUIRED"
                }
              ]
            }
          ]
        },